package com.woan.api.idao.dao;

import java.util.List;
import org.hibernate.LockMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.woan.api.idao.SysUpgradeIDAO;
import com.woan.api.model.SysUpgrade;

/**
 * A data access object (DAO) providing persistence and search support for
 * SysUpgrade entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.woan.api.model.SysUpgrade
 * @author MyEclipse Persistence Tools
 */

public class SysUpgradeDAO extends HibernateDaoSupport  implements SysUpgradeIDAO{
	public SysUpgrade FindNewVersion(String os,String vername)
	{
		StringBuffer hql = new StringBuffer("from SysUpgrade");
		hql.append(" where os='"+os+"' and versionname='"+vername+"' and isdel='1' order by uploadtime desc");
		try
		{
			System.out.println(hql.toString());
			List<SysUpgrade> list=this.getHibernateTemplate().find(hql.toString());
			if(list!=null&&list.size()>0)
				return list.get(0);
			else
				return null;
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		return null;
	}

}